﻿using System.Data;
using System.Net;
using System.Net.Http.Headers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using OfficeOpenXml;
using Simple.Services;
using Simple.Services.System.QHSEDanger.Models.AnalysisInput;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 隐患类别分析
/// </summary>
[Route("QHSEDangerCategoryAnalysisS/[action]")]
[ApiController]
public class QHSEDangerCategoryAnalysisController : ControllerBase
{
    private readonly DangerCategoryAnalysisService _dangerCategoryAnalysisService;

    public QHSEDangerCategoryAnalysisController(DangerCategoryAnalysisService dangerCategoryAnalysisService)
    {
        _dangerCategoryAnalysisService = dangerCategoryAnalysisService;
    }
    /// <summary>
    /// 隐患类别分析--隐患类别
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_d_lb_analysis")]
    public async Task<AppResult> DangerCategoryAnalysis([FromBody] DangerSpecialtyAnalysisInput input)
    {
        var res = await _dangerCategoryAnalysisService.DangerCategoryAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 隐患类别分析--隐患级别
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_d_lb_analysis")]
    public async Task<AppResult> DangerTypeAnalysis([FromBody] DangerSpecialtyAnalysisInput input)
    {
        var res = await _dangerCategoryAnalysisService.DangerTypeAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 隐患类别分析--隐患原因
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_d_lb_analysis")]
    public async Task<AppResult> DangerCauseAnalysis([FromBody] DangerSpecialtyAnalysisInput input)
    {
        var res = await _dangerCategoryAnalysisService.DangerCauseAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 隐患类别分析--归属直线部门
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_d_lb_analysis")]
    public async Task<AppResult> DirectDepartmentAnalysis([FromBody] DangerSpecialtyAnalysisInput input)
    {
        var res = await _dangerCategoryAnalysisService.DirectDepartmentAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
    /// <summary>
    /// 隐患类别分析--体系要素
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_d_lb_analysis")]
    public async Task<AppResult> HSEAnalysis([FromBody] DangerSpecialtyAnalysisInput input)
    {
        var res = await _dangerCategoryAnalysisService.HSEAnalysisAsync(input);
        return AppResult.Status200OK(data: res);
    }
}

